﻿#pragma once

#include "System.h"

class SGHSystem : public System
{
public:
  SGHSystem(const Configuration& cfg);
  virtual ~SGHSystem(){};

  void Init() override;
  void Evolve() override;
  void virtual InitialCondition() = 0;
  void InitVariable() override;
  virtual void PreSolve();

protected:
  /// @brief 初始化辅助变量

  virtual void ComputeTimeStepper();
  virtual void Solve();
  virtual void PostSolve();

  void UpdateCellToPointForce();
  virtual void UpdatePointForce();

  // 辅助变量更新
  //void UpdateAuxVariable();
  //void UpdateCellArea();
  //void UpdateCellEnergy();
  //void UpdatePointMass();
  //void UpdatePointForce();

  // 时间推进
  //void UpdatePosition();
  //void UpdateEnergy();

protected:
  Real _dt = 0;
  Invoker invoker;

  /// @brief CellToPointForce
  ArrayHandle<Vec3f> _c2n_force;
  ArrayHandle<Id> _c2n;
  ArrayHandle<Id> _periodic_map;
};
